package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.service.MemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.MemberMapper;
import com.itheima.pojo.Member;
import org.apache.dubbo.config.annotation.Service;

@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {

    @Override
    public Long saveMember(Member member) {
        this.saveOrUpdate(member);
        return member.getId();
    }

    @Override
    public Member findByTelephone(String telephone) {
        QueryWrapper<Member> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("telephone",telephone);
        return this.getOne(queryWrapper);
    }
}